package com.myeasyexcel.config;

import com.myeasyexcel.pojo.DTO.UserDto;
import com.myeasyexcel.pojo.entity.User;
import com.myeasyexcel.service.Impl.UserImportService;
import com.myeasyexcel.utils.EasyExcelListener;
import com.myeasyexcel.utils.ExcelCheckResult;
import com.myeasyexcel.utils.ExcelErrMsg;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class UserDtoListener<T extends ExcelErrMsg> extends EasyExcelListener<T> {

    private final UserImportService userImportService;

    public UserDtoListener(int batchCount, UserImportService userImportService) {
        super(batchCount);
        this.userImportService = userImportService;
    }

    @Override
    public String otherParamCheck(T t, String errMsg) {
        return errMsg;
    }

    @Override
    public ExcelCheckResult<T> dbOperateReturnData(List list) {
        return userImportService.checkImportExcel(list);
    }
}